import React, { useEffect } from 'react'
import { Link, Navigate, useNavigate } from 'react-router-dom'; // v6: Redirect 改为 Navigate

const Index = () => {
    const list = [
        {
            cid: "110",
            title: "全国解封了-1"
        },
        {
            cid: "111",
            title: "全国解封了-2"
        },
        {
            cid: "112",
            title: "全国解封了-3"
        }
    ];

    const navigate = useNavigate();
    useEffect(() => {
        // navigate('/home/')
    }, []);

    return (
        <div>
            {/* 标签重定向 */}
            {/* <Navigate to="/home/" /> */}
            <h2>JSPang.com</h2>
            <ul>
                {
                    list.map((item, index) => {
                        return (
                            <li key={index}>
                                <Link to={/list/ + item.cid}>{item.title}</Link>
                            </li>
                        )
                    })
                }
            </ul>
        </div>
    )
}

export default Index;